home *** CD-ROM | disk | FTP | other *** search
- /*
- * file: Instrument Editor.h
- *
- * started 12 January 1992 16:45
- * david van brink
- *
- * A starting point for BigEasy programs
- *
- */
-
- #ifndef _InstrumentEditor_
- #define _InstrumentEditor_
-
- /*--------------------------
- Inclusions
- --------------------------*/
-
- #include <Files.h>
- #include <Windows.h>
- #include <Lists.h>
-
- #include "BigEasyControls.h"
- #include <QuickTimeComponents.h>
- //#include "NoteAllocatorComponent.h"
- #include "IE KeyboardDiagram.h"
-
- /*--------------------------
- Structures
- --------------------------*/
- #define kDocMargin 9
- #define kHeaderHeight 17
- #define kSliderWidth 150
- #define kInstrumentListWidth 127
- #define kInstrumentListCellHeight 13
- #define kTextAllowance 12
-
- #define kStatLineCount 4
- #define kStatHeight (kTextAllowance * kStatLineCount + 6)
- #define kStatTop (kHeaderHeight+kDocMargin)
- #define kStatBottom (kStatTop+kStatHeight)
- #define kStatLeft kDocMargin
- #define kStatRight (kStatLeft+kInstrumentListWidth)
-
- #define kKeyboardTop (kStatBottom+kDocMargin)
- #define kKeyboardBottom (kKeyboardTop+0x1F)
- #define kKeyboardLeft kDocMargin
-
- #define kKeyboardOctaveCount (kInstrumentListWidth/63)
- #define kKeyboardRight (kKeyboardLeft+kKeyboardOctaveCount*63+1)
-
- #define kInstrumentListTop (kKeyboardBottom+kDocMargin)
- #define kInstrumentListLeft (kStatLeft)
- #define kInstrumentListRight (kStatRight)
-
- #define kSliderzoneLeft (2*kDocMargin+kInstrumentListWidth)
-
- #define kMaxInstruments 256
-
- enum
- {
- mNew = 100,
- mOpen,
- mCPULoad,
-
- mFirstDocOnly,
- mClose,
- mSave,
- mSaveAs,
- mGetInstrument,
- mSetInstrument,
- mNameInstrument,
- mRandomizeKnobs,
-
- mGlobalKnobs, /* also used as tag for which to display of 3 */
- mInstrumentKnobs,
- mControllers,
-
-
-
- mPitchbendDoc,
- mMicrotoneDoc,
- mTestDoc,
-
- mLastDocOnly
- };
-
-
- typedef struct
- {
- OSType synthType;
- Str31 synthName;
- } SynthMenuEntry;
-
- typedef struct
- {
- short synthCount;
- SynthMenuEntry entry[1];
- } SynthList, **SynthListHandle;
-
-
-
- #define kDocVersion 1
- typedef struct
- {
- OSType synthType;
- Str31 synthName;
- } TPartialSaveRecord;
-
-
-
- typedef struct
- {
- Boolean used;
-
- Boolean everSaved;
- Boolean changed;
- Boolean littleChanged; /* Save available, but no "Save Discard?" on close */
-
- FSSpec docSpec;
- TPartialSaveRecord sr;
-
- WindowPtr w;
-
- /*----*/
- NoteAllocator na;
-
- EasyControlList ecl;
- EasyControl *ec;
-
- short whichList; /* which knobs? from above enum */
- short knobCount;
- Str255 instrumentName;
- MusicComponent ci;
- long part;
-
- NoteChannel nc;
-
- SynthesizerDescription sd;
- // long firstModifiableInstrument;
- long globalKnobCount;
- KnobDescription **gkdList;
- long instrumentKnobCount;
- KnobDescription **ikdList;
- long controllerCount;
-
- ToneDescription td;
- long stashInstrument;
- long recallInstrument;
-
- Rect virtualSliderBounds; /* 0,0 -> x,y, the virtual workspace */
- Rect visibleSliderBounds; /* x1,y1 -> x2,y2, the present visible part */
- ControlHandle horizontalScroller;
- ControlHandle verticalScroller;
- long lastH, lastV; /* matches the scroller controls, it is
- * the virtual coordinate of the topLeft of
- * the visible bounds.
- */
-
- ListHandle listH;
- Rect statBounds;
- short instrumentCount;
- InstrumentDataHandle instrument[kMaxInstruments];
-
- unsigned char keyVel[128]; /* array for keyboard diagram drawing */
- Boolean controllersDirty;
-
- KeyboardDiagram kd;
- } TDoc;
-
- typedef struct
- {
- long docVersion; /* quick check that we can really open the file */
- Rect windowRect;
- TPartialSaveRecord sr;
- } TSaveRecord;
-
-
-
-
-
- /*--------------------------
- Variables
- --------------------------*/
-
- #ifdef globals
- #define VAR
- #else
- #define VAR extern
- #endif
-
- #define kFirstDocWindow 1
- #define kDocMax 5
- VAR TDoc gDoc[kDocMax];
- VAR short gDocCount;
-
- VAR SynthListHandle gSynthListH;
-
- #undef VAR
-
-
- /*--------------------------
- Prototypes
- --------------------------*/
-
- void NewDocFromSaveRecord(short docNumber,TSaveRecord *sr,SynthMenuEntry *sme);
- void DrawDoc(short n);
- void ClickDoc(short n,Point p,short mods);
-
- void ResizeDoc(short n, Point *oldSize, Point *newSize, short modifiers);
- void FlashResult(ComponentResult result);
-
- void SetupSliderClipDoc(TDoc *d);
- void DoneSliderClipDoc(TDoc *d);
- void DrawStats(TDoc *d);
- void UpdateSliderKnobs(TDoc *d);
-
- void MakeControlsFromKnobList(TDoc *d,Rect *outRect);
-
- void FixUpMenus(TDoc *d);
- void FixForSize(TDoc *d);
-
- SynthListHandle GetSynthesizerList(void);
-
- void DoGlobalKnobs(short n, short menuItem, short menuRef);
- void DoInstrumentKnobs(short n, short menuItem, short menuRef);
- void DoControllers(short n, short menuItem, short menuRef);
-
- void PitchBendDoc(short n, short menuItem, short menuRef);
- void MicrotoneDoc(short n, short menuItem, short menuRef);
- void NotesOnDoc(short n, short menuItem, short menuRef);
- void NotesOffDoc(short n, short menuItem, short menuRef);
- void SetInstrumentDoc(short n, short menuItem, short menuRef);
-
- void SetInstrumentForDoc(TDoc *d,InstrumentDataHandle iH);
- void NewScrollDoc(TDoc *d,Boolean doScroll,RgnHandle updateRgn);
-
- #endif _InstrumentEditor_
-